package test.poi;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @Description TODO(这里用一句话描述这个类的作用)
 *
 * @author liuqinghua
 * @date 2023-8-24
 */
public class RegexExample {
    public static void main(String[] args) {
        String input = "Hello 123 World";

        // 匹配数字
        Pattern pattern = Pattern.compile("\\d+");
        Matcher matcher = pattern.matcher(input);

        // 查找匹配的数字并替换为"X"
        String result = matcher.replaceAll("X");

        System.out.println("原始字符串: " + input);
        System.out.println("替换后的字符串: " + result);
    }
}
